export class ReturnResult <T> {
  private code: number;

  private message: string;

  protected data: T;

  protected status: 'Success' | 'Fail';

  constructor(code: number, message: string, data: T, status?: 'Success' | 'Fail') {
    this.code = code;
    this.message = message;
    this.data = data;
    this.status = status ?? 'Success';
  }

  public toString() {
    return `ReturnResult [code=${this.code}, message=${this.message}, data=${this.data}]`;
  }

  public getCode() {
    return this.code;
  }

  public setCode(code: number) {
    this.code = code;
  }

  public getMessage() {
    return this.message;
  }

  public setMessage(message: string) {
    this.message = message;
  }

  public getData() {
    return this.data;
  }

  public setData(data: T) {
    this.data = data;
  }
}
